<?php

namespace api\controller;

use common\controller\VerifyController;
use common\service\TaskLibraryService;
use think\Exception;
use think\Response;
use think\Request;

class TaskLibraryController extends VerifyController
{

    private $taskLibraryService;

    public function __construct()
    {
        parent::__construct();
        $this->taskLibraryService = TaskLibraryService::getInstance();
    }

    /**
     * 任务库列表查询
     * @param Request $request
     * @return Response
     * @throws Exception
     */
    public function list(Request $request)
    {
        $param = $request->param();
        $res = $this->taskLibraryService->list($param, $request->getTenantId(), $request->getUserId());
        return json(success_response('', $res));
    }

    /**
     * 任务库列表查询
     * @param Request $request
     * @return Response
     * @throws Exception
     */
    public function getTaskPageEpisodeIds(Request $request)
    {
        $param = $request->param();
        $res = $this->taskLibraryService->getTaskPageEpisodeIds($param['project_id'], $param['page']);
        return json(success_response('', $res));
    }
}
